package com.qfedu.meidijiaju.controller;


import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.FaxiantieziYxy;
import com.qfedu.meidijiaju.service.FaxiantieziYxyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 发现帖子 前端控制器
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-03
 */
@Api(tags = "发现模块帖子相关")
@RestController
@RequestMapping("/meidijiaju/faxiantiezi-yxy")
public class FaxiantieziYxyController {

    @Autowired
    private FaxiantieziYxyService faxiantieziYxyService;

    @ApiOperation(value = "/根据发现五个小模块对应id 查询 对应小模块的帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "faxiantypeId",value = "推荐模块不传,其余四个小模块对应的id 从左到右以此1，2，3，4",paramType = "query",dataType = "string")
    })
    @RequestMapping(value = "/allFaXianTieZiByFaXianId",method = RequestMethod.GET)
    public ResponseData<List<FaxiantieziYxy>> allFaXianTieZiByFaXianId(String faxiantypeId) {

        return faxiantieziYxyService.allFaXianTieZiByFaXianId(faxiantypeId);
    }

    @ApiOperation(value = "/根据帖子对应id 查询 对应的帖子信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tieziId",value = "对应的帖子id",paramType = "query",dataType = "int")
    })
    @RequestMapping(value = "/findFaXianTieZiByTieZiId",method = RequestMethod.GET)
    public ResponseData<FaxiantieziYxy> findFaXianTieZiByTieZiId(int tieziId){

        return faxiantieziYxyService.findFaXianTieZiByTieZiId(tieziId);
    }

    @ApiOperation(value = "/添加帖子")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "faxiantieziYxy",value = "帖子需要参数实体类",paramType = "insert",dataType = "FaxiantieziYxy")
//    })
    @RequestMapping(value = "/addFaXianTieZi",method = RequestMethod.POST)
    public ResponseData<String> addFaXianTieZi(FaxiantieziYxy faxiantieziYxy){

        return faxiantieziYxyService.addFaXianTieZi(faxiantieziYxy);

    }

    @ApiOperation(value = "/通过内容或者标题模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contentOrTitle",value = "内容或者标题",paramType = "query",dataType = "string")
    })
    @RequestMapping(value = "/findFaXianTieZiByLike",method = RequestMethod.GET)
    public ResponseData<List<FaxiantieziYxy>> findFaXianTieZiByLike(String contentOrTitle){

        return faxiantieziYxyService.findFaXianTieZiByLike(contentOrTitle);
    }

    @ApiOperation(value = "/通过话题id查询对应的相关帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "huaTiId",value = "话题id",paramType = "query",dataType = "int")
    })
    @RequestMapping(value = "/findFaXianTieZiByHuaTiId",method = RequestMethod.GET)
    public ResponseData<List<FaxiantieziYxy>> findFaXianTieZiByHuaTiId(int huaTiId){

        return faxiantieziYxyService.findFaXianTieZiByHuaTiId(huaTiId);
    }
}

